/*
 * Main Custodian menu
 * Vic.Sorbi
 */
package ganga.custodian;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * This activity aimed to be a main user menu screen
 * @author Apocrypha
 * @created at 15.05.2011
 */
public class MainMenu extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
        
        //Оставлено для устрашения неискушённых, вместо такого стиля
        //следует явно выписывать функции-обработчики и привязывать их через XML
        Button alarmButton = (Button)findViewById(R.id.alarmButton);
        alarmButton.setOnClickListener(
        		new View.OnClickListener(){
        			public void onClick(View view){
        				doAlarm();
        				}
        		});
    }
    protected void doAlarm() {
    	CustodianApplication.getInstance().notificationExecutor.sendSms();
    	//CustodianApplication.getInstance().notificationExecutor.play();
    	CustodianApplication.getInstance().notificationExecutor.doPlayTaskManFillBad();
    	CustodianApplication.getInstance().notificationExecutor.call();

	}
	public void exitButton_Click(View v){
    	finish();
    }
    public void Click_Chart(View v){
    	Intent i = new Intent(MainMenu.this, ganga.custodian.plot.PlotActivity.class);
    	startActivity(i);	
    }
    public void SensorsView(View v1){
    	Intent i1 = new Intent(MainMenu.this,ganga.custodian.sandbox.SensorsParam.class);
    	startActivity(i1);
    }
    public void CallPatientCard (View v1){
    	Intent i1 = new Intent(MainMenu.this,ganga.custodian.sandbox.PatientCard.class);
    	startActivity(i1);
    }
    public void realTimeButton_Click(View v1){
    	Intent i1 = new Intent(MainMenu.this,ganga.custodian.sandbox.MonitorScreen.class);
    	startActivity(i1);
    }
}//MainMenu

//The application Context is the central location for all top-level application functionality.
//Retrieving the Application Context
//Context context = getApplicationContext();